package com.example.monit.controller;

import com.example.monit.bean.BasicBehavior;
import com.example.monit.bean.ResponseRust;
import com.example.monit.service.BasicBehaviorService;
import com.example.monit.vo.BaseQueryVo;
import com.example.monit.vo.BasicBehaviorTotalVo;
import com.example.monit.vo.BasicBehaviorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutionException;

@RestController
@RequestMapping("/behaviors")
public class BasicbehaviorController {

    @Autowired
    private BasicBehaviorService basicBehaviorService;


    /**
     * 基础行为数据插入
     */
    @PostMapping("/basicbehaviors")
    public ResponseRust totalBasicBehaviorLoad(@RequestBody List<BasicBehavior> basicIndicator) throws IOException {
        return basicBehaviorService.upLoadBasicBehavior(basicIndicator);
    }

    /**
     * 基础行为数据查询
     */
    @GetMapping("/basicbehaviors")
    public ResponseRust getBasicBehaviorLoad(BasicBehaviorVo basicIndicatorVo) throws IOException {
        return this.basicBehaviorService.queryBasicBehavior(basicIndicatorVo);
    }

    /**
     * 基础行为数据统计
     */
    @GetMapping("/basicbehaviorstatistics")
    public ResponseRust totalBasicBehavior(BasicBehaviorTotalVo basicIndicatorTotalVo) throws IOException {
        return this.basicBehaviorService.totalBasicBehavior(basicIndicatorTotalVo);
    }

    /**
     * 用户行为列表
     */
    @GetMapping("/useraction")
    public ResponseRust getUserActionList(BaseQueryVo querysVo) throws ExecutionException, InterruptedException {
        return this.basicBehaviorService.getUserActionList(querysVo);
    }
}
